import 'package:flutter/material.dart';

class AnimationDemo2 extends StatefulWidget {
  const AnimationDemo2({super.key});

  @override
  State<AnimationDemo2> createState() => _AnimationDemo2State();
}

class _AnimationDemo2State extends State<AnimationDemo2> {
  bool flag = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Title")),
      body:
          // AnimatedPadding(
          //   duration: Duration(milliseconds: 250),
          //   padding: EdgeInsets.fromLTRB(10, 400, 10, 10),
          //   child: Container(
          //     width: 100,
          //     height: 100,
          //     color: Colors.red
          //   ),
          // ),
          AnimatedOpacity(
            duration: Duration(milliseconds: 250),
            opacity: 0.5,
            child: Container(width: 100, height: 100, color: Colors.red),
          ),

      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            flag = !flag;
          });
        },
      ),
    );
  }
}
